package com.solar.etl.transform;

import org.dom4j.Element;

import com.solar.etl.config.mapping.Field;
import com.solar.etl.spi.Itransform;

public class MaxLengthTransform implements Itransform{

	@Override
	public String transform(Field field, Element item) {
		if(null!=field.destValue&&!"".equals(field.destValue)){
			if(field.destValue.length()>Integer.valueOf(item.attributeValue("length"))){
				field.destValue=field.destValue.substring(0, Integer.valueOf(item.attributeValue("length")));
			}
		}
		return null;
	}

}
